$sor Function
Syntax
Arguments
- elementelement|string
The element you wish to size.
- parentElementelement|string
The element you wish to size relatively to.
- typestring
A string defining what properties to size. Values can be:
- Value
- Description
- w
Size width only
- h
Size height only
- wh
Size width and height.
- hw
Size height and width.
- firstOffsetnumber
Specifies an offset in pixels. If 'wh' or 'hw' are specified as the type, defines the offset for the first character.
- secondOffsetnumber
Specifies an offset in pixels. If 'wh' or 'hw' are specified as the type, defines the offset for the second character.
Description
Sizes an element relatively to another element.
Discussion
The $sor() function sizes an element relatively to another element. IE, the function makes one object the same size as another object.
The firstOffset and secondOffset parameters allow you to optionally specify pixel offsets. For example, if you specify to size the object to be 10 pixels wider and 5 pixels higher than the reference element, you would specify a FIRSTOFFSET of 10 and a SECONDOFFSET of 5 (assuming that you specified the TYPE as 'wh'). If you specified the TYPE as 'hw', then you would swap the order of the offsets.
Example
/*Sets the child object to have the same width and height as the parent object.*/ $sor('childObject','parentObject','wh'); /*Sets the child object to have the same width + 6 px and same height + 4 px as the parent object.*/ $sor('childObject','parentObject','wh',6,4); /*Same as above example, but since TYPE was specified as 'hw' (and not 'wh'), the order of the offsets is swapped.*/ $sor('childObject','parentObject','hw',4, 6);
See Also